package main

import (
	"fmt"
	"time"
)

//used for sub go routine
func display(num int) {
	count := 1
	for {
		fmt.Printf("======this is son go routine(enter %d), 当前count: %d\n", num, count)
		count++
		time.Sleep(500 * time.Millisecond)
	}
}
func main() {

	//启动子go程
	for i := 0; i < 3; i++ {
		go display(i)
	}

	// 主go程
	count := 1
	for {
		fmt.Println("main go routine:", count)
		count++
		time.Sleep(1 * time.Second)
	}
}
